<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./react/react17.development.js"></script>
    <script src="./react/react-dom17.development.js"></script>
    <script src="./react/babel.min.js"></script>
</head>

<body>
    <div id="main"></div>

    <script type="text/babel">
        // class 组件名 extends 继承的父类名
        class Com extends React.Component {
            constructor(){

                super();
                console.log(this.state);
                this.state = {
                    num:100
                }
                this.str = "aaa";

            }
            render() {
                return (<div>
                    <h2>这是com组件</h2>
                    <p>{this.state.num}</p>
                    <p>{this.str}</p>
                    <ComTwo title="标题"/>
                </div>)
            }
        }

        class ComTwo extends React.Component {
            render() {

                console.log(this.props);
                return (<div></div>)
                

            }
        }
        ReactDOM.render(<Com/>, document.getElementById("main"));




    </script>
</body>

</html>